<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>文本输入框高度自适应测试</title>
		<script type="text/javascript" src="style/js/base/jquery-1.9.1.min.js" ></script>
		<style>
			textarea{
				resize: none;
				height: 30px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<label>备注:</label>
		<textarea id="txt" cols="20" rows="3" onkeyup="MaxMe(this)"></textarea>
		<script>
			function MaxMe(o) {     
			      if (window.navigator.userAgent.indexOf("Firefox") > -1) {
			        o.style.height = o.scrollTop + o.scrollHeight + "px";
			      }
			      else {
			        if (o.scrollTop > 0) 
			        	o.style.height = o.scrollTop + o.scrollHeight + "px";
			      }
	    	}
		</script>
	</body>
</html>
